﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Web;

namespace B2B.Models
{
    public class DonViTinh
    {
        int maDVT;

        public int MaDVT
        {
            get { return maDVT; }
            set { maDVT = value; }
        }
        string tenDVT;

        public string TenDVT
        {
            get { return tenDVT; }
            set { tenDVT = value; }
        }

        public ArrayList DanhSachDonViTinh()
        {
            ArrayList list_DVT = new ArrayList();
            SqlConnection conn = KetNoi.Connection();
            SqlCommand cmd = new SqlCommand("SP_DANHSACHDONVITINH", conn);
            cmd.CommandType = CommandType.StoredProcedure;
            conn.Open();
            SqlDataReader reader = cmd.ExecuteReader();
            while (reader.Read())
            {
                DonViTinh dvt = new DonViTinh();
                dvt.MaDVT = reader.GetInt32(0);
                dvt.TenDVT = reader.GetString(1);
                list_DVT.Add(dvt);
            }
            conn.Close();
            return list_DVT;
        }
    }
}